# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=triton
_pkgname=Triton
pkgver=4324.4f7ddb77
pkgrel=1
epoch=1
pkgdesc='A Dynamic Binary Analysis (DBA) framework.'
groups=('blackarch' 'blackarch-binary' 'blackarch-reversing')
arch=('x86_64' 'aarch64')
url='https://github.com/JonathanSalwan/Triton'
license=('BSD')
depends=('capstone' 'z3' 'python' 'boost')
makedepends=('git' 'cmake' 'python-setuptools')
#source=("https://github.com/JonathanSalwan/Triton/archive/v$pkgver.zip")
source=("$pkgname::git+https://github.com/JonathanSalwan/$_pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  mkdir -p build

  cd build

  cmake -DCMAKE_INSTALL_PREFIX=/usr ..

  make

  #python2 setup.py build
}

package() {
  cd "$pkgname/build"

  make DESTDIR="$pkgdir" install

  #python2 setup.py install --root="$pkgdir"

  cd ..

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  #mv "$pkgdir/lib/"* "$pkgdir/usr/lib/"

  #rmdir "$pkgdir/lib"
}

